// 项目路由，导航配置文件
import { Navigation } from 'react-native-navigation'

import Login from '../pages/Login'
import My from '../pages/My'
import GoCircle from '../pages/Gocircle'
// import GoHealth from '../pages/GoHealth'
import GoHealth from '../pages/GoHealth'
import GoRun from '../pages/GoRun'
import GoStore from '../pages/GoStore'
import InputAuthCode from '../pages/InputAuthCode'
import Introduction from '../pages/Introduction'
import DongTaiDetail from '../components/DongTaiDetail'
import ShareCom from '../components/ShareCom'
import PreviewsImg from '../components/PreviewsImg'

import App from '../../App'
// 组件注册
Navigation.registerComponent('Login', () => Login)
Navigation.registerComponent('My', () => My)
Navigation.registerComponent('GoCircle', () => GoCircle)
Navigation.registerComponent('GoHealth', () => GoHealth)
Navigation.registerComponent('GoStore', () => GoStore)
Navigation.registerComponent('GoRun', () => GoRun)
Navigation.registerComponent('InputAuthCode', () => InputAuthCode)
Navigation.registerComponent('Introduction', () => Introduction)
Navigation.registerComponent('DongTaiDetail', () => DongTaiDetail)
Navigation.registerComponent('ShareCom', () => ShareCom)
Navigation.registerComponent('PreviewsImg', () => PreviewsImg)



Navigation.registerComponent('App', () => App)

// 配置Rn中的导航
// 1.欢迎屏幕的导航配置
export const WelcomeScreen = {
  root: {
    stack: {
      id: 'WELCOMESCREEN',
      children: [
        // 栈可以用多个子对象初始化，在这种情况下，最后一个子对象将显示当前的子对象，而第一个子对象将被隐藏，在这种情况下，back按钮将自动显示，单机他将返回到堆栈中，显示第一个（前一个）子元素，一旦根子元素变得可见。back按钮就会被隐藏。
        {
          component: {
            name: 'Introduction'
          }
        }
      ]
    }
  }
}

// 2.登录屏幕的导航配置
export const LoginRoot = {
  root: {
    stack: {
      id: 'LOGIN_LAYOUT',
      children: [
        {
          component: {
            name: 'Login'
          }
        }
      ]
    }
  }
}

// 3.配置APP主屏幕页面的布局结构：
export const MainRoot = {
  root: {
    // 建议在栈中嵌套bootmTabs,bottomTabs中，嵌套stack
    bottomTabs: {
      id: 'BOTTOM_TABS_LAYOUT',
      children: [
        // 每一个对象，就是一个bottomTab选项卡对象
        {
          stack: {
            id: 'HOME_TAB',
            children: [
              {
                component: {
                  id: 'GO_CIRCLE_SCREEN',
                  name: 'GoCircle'
                }
              }
            ],
            options: {
              bottomTab: {
                text: 'Go圈',
                icon: require('../assets/bottomTabs/home.png'), // 默认图标
                selectedIcon: require('../assets/bottomTabs/home-s.png') // 选中的图标
              }
            }
          }
        },
        {
          stack: {
            id: 'HEALTH_TAB',
            children: [
              {
                component: {
                  id: 'GO_HEALTH_SCREEN',
                  name: 'GoHealth'
                }
              }
            ],
            options: {
              bottomTab: {
                text: 'Go健康',
                icon: require('../assets/bottomTabs/xin.png'), // 默认图标
                selectedIcon: require('../assets/bottomTabs/xin-s.png') // 选中的图标
              }
            }
          }
        },
        {
          stack: {
            id: 'RUN_TAB',
            children: [
              {
                component: {
                  id: 'GO_RUN_SCREEN',
                  name: 'GoRun'
                }
              }
            ],
            options: {
              bottomTab: {
                text: 'Go运动',
                icon: require('../assets/bottomTabs/dian.png'), // 默认图标
                selectedIcon: require('../assets/bottomTabs/dian-s.png') // 选中的图标
              }
            }
          }
        },
        {
          stack: {
            id: 'STORE_TAB',
            children: [
              {
                component: {
                  id: 'GO_STORE_SCREEN',
                  name: 'GoStore'
                }
              }
            ],
            options: {
              bottomTab: {
                text: 'Go商城',
                icon: require('../assets/bottomTabs/shop.png'), // 默认图标
                selectedIcon: require('../assets/bottomTabs/shop-s.png') // 选中的图标
              }
            }
          }
        },
        {
          stack: {
            id: 'MY_TAB',
            children: [
              {
                component: {
                  id: 'GO_MY_SCREEN',
                  name: 'My'
                }
              }
            ],
            options: {
              bottomTab: {
                text: '我的',
                icon: require('../assets/bottomTabs/my.png'), // 默认图标
                selectedIcon: require('../assets/bottomTabs/my-s.png') // 选中的图标
              }
            }
          }
        }
      ]
    }
  }
}

// 4.默认APP导航样式的设置：
Navigation.setDefaultOptions({
  // 设置APP底部的整体的TABS的配置
  bottomTabs: {
    titleDisplayMode: 'alwaysShow'
  },
  // 手机状态栏的配置
  statusBar: {
    backgroundColor: '#fff', // 设置状态栏的颜色
    style: 'dark', // 手机模式，设置文字和手机信息等字体的颜色
    visible: true, // Boolean 是否显示状态栏
  },
  // APP的顶部配置
  topBar: {
    title: {
      color: 'black'
    },
    backButton: {
      color: '#666666'
    },
    background: {
      color: '#ffffff'
    }
  },
  // APP底部的tab的配置
  bottomTab: {
    fontSize: 12,
    selectedFontSize: 14,
    iconWidth: 20,
    iconHeight: 20,
    textColor: '#666666',
    selectedTextColor: '#0099ff',
    fontWeight: 700
  }
})
